<template>
  <div class="hello">
    <div>{{txt}}</div>
    <editable-div v-model="txt" ref="editable"/>
    <!-- <textarea type="text" v-model="txt" style="width: 300px;float:left;"/> -->
    <emjoy @chooseEmjoy="clickEmjoy"/>
  </div>
</template>

<script>
import Emjoy from "./Emjoy";
import EditableDiv from "./EditableDiv";
export default {
  name: "HelloWorld",
  components: {
    Emjoy,
    EditableDiv
  },
  props: {
    msg: String
  },
  data() {
    return {
      txt: ""
    };
  },
  methods: {
    clickEmjoy(obj) {
      // this.txt += `${obj.tag}`;
      // this.$el.focus();
      this.$refs.editable.insertText(obj)
    }
  }
};
</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style>
* {
  margin: 0;
  padding: 0;
}
h3 {
  margin: 40px 0 0;
}
ul {
  list-style: none;
  padding: 0;
}
a {
  color: #42b983;
}
</style>
